<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{
            position: absolute;
            bottom: 0;
            right: 0;
        }
    </style>
</head>
<body>
<div id="f1"><img src="img.png"></div>
<button onclick="run1()">点击更改位置</button>
</body>
<script>
    function run1() {
        var id = document.getElementById("f1");
        var x = parseInt( Math.random()*100);
        var y =parseInt(Math.random()*100);
        id.style.left=x+"px";
        id.style.top=y+"px";
    }
</script>
</html>